package com.kly.user.enums;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 注册页面配置
 * @author linqu
 * 1.Age 2.Nickname 3.Gender 4.Photo 5.I want
 */
public enum PageType {

    FILL_AGE(1, "Age", "填写出生年月页面"),
    FILL_NICKNAME(2, "Nickname", "填写Nickname页面"),
    FILL_GENDER(3, "Gender", "填写Gender页面"),
    FILL_PHOTO(4, "Photo", "填写Photo页面"),
    FILL_I_WANT(5, "I want", "填写I want页面"),
    ;

    private final int type;

    private final String Value;

    private final String description;


    PageType(int type, String value, String description) {
        this.type = type;
        Value = value;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return Value;
    }

    public String getDescription() {
        return description;
    }


    public static PageType fromType(Integer type) {
        if (Objects.isNull(type)) {
            return null;
        }
        for (PageType userStatus : values()) {
            if (userStatus.getType() == type) {
                return userStatus;
            }
        }
        return null;
    }

    public static List<Integer> getAllTypes() {
        List<Integer> types = new ArrayList<>();
        for (PageType pageType : values()) {
            types.add(pageType.getType());
        }
        return types;
    }
}
